import { fromJS,Map} from "immutable";
import { observable,action,makeObservable } from "mobx";
// import { makePersistable } from "mobx-persist-store";


class MyData {
    @observable userInfo = fromJS({
        password:'',
        phone:'',
        role:0,
        username:'',
        _id:'',
    })

    @action getUserInfo = (p:foundUserType)=>{
        console.log(p);
        
        this.userInfo = fromJS(p)
    }
    constructor(){
        makeObservable(this)
        // makePersistable(this, {
        //     name: 'mobxDemo', // 存储到localStorage当中的key值是什么
        //     properties: ['userInfo'], // 需要持久化的数据是什么,此数据需要为上面声明了的变量
        //     storage: window.localStorage, // 用哪种方式存储
        // })
    }

}

export default new MyData()